package com.tencent.iov.cowin.befsale.clue.value.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Date;

/**
 * @Describe: 分配状态类型
 * @author: whp
 * @created: 2021-12-27 18:22:10
 * @version: 1.0
 */
@Getter
@AllArgsConstructor
public enum DistributeEnum {

    EXPIRY_OUT(-1,"已逾期"),
    DISTRIBUTE_PENDING(0,"待分配"),
    DISTRIBUTE(1,"已分配");

    Integer code;
    String name;


    /**
     * 根据是否分配顾问，根据当前时间是否逾期
     * @param followTime
     * @param isDistribute
     * @return
     */
    public static Integer getDictionaries(Date followTime,Boolean isDistribute){
        if(isDistribute){
            return DISTRIBUTE.getCode();
        }else{
            if(followTime != null){
                if(followTime.getTime() < new Date().getTime()){
                    return EXPIRY_OUT.getCode();
                }else {
                    return DISTRIBUTE_PENDING.getCode();
                }
            }else{
                return DISTRIBUTE_PENDING.getCode();
            }

        }
    }



}
